/*
 * =====================================================================================
 *
 *       Filename:  slist.h
 *
 *    Description:  single list
 *
 *        Version:  1.0
 *        Created:  06/13/2012 12:42:28 AM
 *       Revision:  none
 *       Compiler:  gcc
 *
 *         Author:  ShangGuan DataStructure 
 *   Organization:  
 *
 * =====================================================================================
 */
#include <log4c.h>
#include <sg_int.h>

typedef int (*compare_callback)(void* v1, void* v2);

typedef struct slist_node_t
{
	struct slist_node_t* next;
	void* bucket;
}slist_node_t;

typedef struct slist_t
{
	slist_node_t* node;
	compare_callback compare;
	UINT32_T capacity;
}slist_t;

slist_t* slist_create(UINT32_T capacity);
void slist_destroy(slist_t* slist);
slist_t* slist_insert(void* bucket);
slist_t* slist_insert_after(slist_node_t* node,void* bucket);
slist_t* slist_remove(slist_node_t* node);
slist_t* slist_search(slist_node_t* node,void* data);

#define slist_capacity(s) (s->capacity)
